package com.test.impl;

import com.test.dto.SchoolDTO;
import com.test.service.SchoolService;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;

/**
 * @author dong
 * @date 2017/12/14
 * Description:
 */
@Service("schoolService")
public class SchoolServiceImpl implements SchoolService {
    static Logger logger = Logger.getLogger(SchoolServiceImpl.class);

    public List<SchoolDTO> getSchoolesByCity(Integer cityId) throws Exception {
        if (null == cityId || cityId < 1)
            throw new Exception("参数异常");
        List<SchoolDTO> schoolDTOS = new LinkedList<SchoolDTO>();
        SchoolDTO schoolDTO = new SchoolDTO();
        schoolDTO.setShcId(1);
        schoolDTO.setShcName("北京大学");
        schoolDTO.setCityId(1);
        schoolDTO.setCityNme("海淀区");
        schoolDTOS.add(schoolDTO);

        schoolDTO = new SchoolDTO();
        schoolDTO.setShcId(2);
        schoolDTO.setShcName("人民大学");
        schoolDTO.setCityId(1);
        schoolDTO.setCityNme("海淀区");
        schoolDTOS.add(schoolDTO);

        return schoolDTOS;
    }

    public static void main(String[] args){


        logger.info(String.format("访问接口成功城市id为%s", 1));
    }

}